1. Field of the Invention
The present invention relates generally to the compiling, loading, and execution of a computer program and, in particular, to the inclusion of descriptive extended attribute information in object modules and load modules concerning the attributes of external symbols and address constants.
2. Description of the Related Art
Programmers write computer programs in high level languages such as assembler language, COBOL, FORTRAN, C, C++, etc. A group of statements written in a language is referred to as a source module. Before the source module can be executed, the source statements within the source module must be transformed to machine readable executable code.
An assembler or compiler, referred to herein as a source translator, translates the source module into an object module, which includes machine readable executable code, data, external symbols, address constants, and further bookkeeping information used in the process of transforming the object module into an executable file. A linkage editor combines one more object modules into a load module in preparation for execution. If one object module includes a reference to an external symbol defined in another object module, then the linkage editor may resolve this reference to the definition in the load module.
Often, the source translator disregards descriptive information included in the source module when generating the object module. As a result, object modules and load modules often include little or no information on the attributes of definition and declaration of symbols. Furthermore, in the prior art, assembler language instructions, such as the ENTRY, CSECT, EXTRN, and DC instructions in the International Business Machines Corporation (“IBM”) High Level Assembler for MVS, VM, and VSE (“IBM High Level Assembler”) do not include descriptive information on the attributes of the symbols used as operands in the assembler language instructions. These and other specific aspects of assembler language discussed herein are described in the publication “High Level Assembler for MVS & VM & VSE, Language Reference for MVS and VM,” Release 2, Document Number SC26-4940-01, IBM Corporation, which publication is incorporated by reference herein.
Generally, the source module and object modules include one or more control sections. A control section is the smallest subdivision of a program that can be relocated as a unit. At coding time, the programmer creates control sections in the source modules, establishes the addressability of each control section, and establishes symbolic linkages between control sections that lie in different source modules. The programmer establishes symbolic linkages by declaring an external symbol in one source module to reference a control section or a point defined within another object module. Source modules external to the module in which the external symbol is defined can reference the text in the location identified by the external symbol. In this way, the external symbol is the vehicle used for establishing symbolic linkages between programs.
In the IBM High Level Assembler language, the programmer can use the ENTRY, CSECT, DXD, RSECT, and START instructions to define external symbols in the source module. The ENTRY instruction defines the external symbol as the location where the symbol is placed. For instance, the instruction ENTRY B defines the external symbol B as a point within the control section where the instruction named B is placed.
The CSECT instruction identifies a control section with an external symbol. For instance, the instruction B CSECT names the following control section B, thereby allowing external source modules to reference the control section identified by the external symbol B. The programmer can declare external symbols in a source module that are not defined in that module using the EXTRN instruction. A declared symbol can be used in instruction operands within that source module.
Symbols can have two types of attributes, inherent (or implicit or intrinsic) and extended (descriptive). Inherent attributes are attributes that are typically part of a fixed set of properties associated with an external symbol. Examples of inherent attributes of a symbol include: addressing mode (AMODE, which implicitly designates the symbol as naming executable code); and residency mode (RMODE, which implicitly designates a region of storage where the object named by the symbol must reside). Descriptive or extended attributes are additional information either derived from the program's language statements or provided by other means. Examples of descriptive attributes include: whether an external symbol reference is to data (and what data types and structures) or to executable code (and what numbers and types of arguments are being passed); whether an external symbol definition is for data (and what data types and structures) or for executable code (and what expected number and types of arguments are to be received).
One of the shortcomings of current methods for using external symbols is that the instructions identifying the symbols do not retain descriptive attribute information on the definition and declaration of the symbols. Current methods provide only minimal support for external symbol attributes, and include no mechanism for providing information on what the symbols name, and any interesting or useful “properties” of the symbols. Further, almost all attribute information is inherent, often by default. This lack of information makes it difficult for the programmer to debug incompatibility errors that arise if the instruction declaring the symbol (e.g., EXTRN) is incompatible with the instruction defining that symbol (e.g., ENTRY or CSECT).
For example, if the external symbol is defined as naming a location having code, but the reference to the symbol expects data, then an incompatibility error may arise. An incompatibility error may also arise if the reference is compatible with only 24-bit addressing and the symbol is defined as using only 31-bit addressing. These incompatibility errors could prevent the program from properly executing. In present techniques for generating object and load modules, there is no way to associate extended descriptive information with a symbol.
Similarly, a program may need to declare multiple sets of attributes to be associated with a given external symbol. To illustrate, suppose a source program A contains multiple calls to an external entry point B:Call B(1, 2) Call B(3.14, ‘ABC’, 6) where the number and types of argument vary from call to call. Because address constants in module A are used to provide the address of the external symbol B, specific extended attributes for each call may be associated with the address constant used for that call.
There is thus a need in the art for providing improved methods and data structures for providing attribute information with symbols and address constants.